package com.liutao.application;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.client.RestTemplate;

/**
 * 用于配置和启动引导
 */
@EnableCircuitBreaker //开启断路器功能
@EnableFeignClients(basePackages={"com.liutao.controller.client"})
@EnableDiscoveryClient
@SpringBootApplication
@ComponentScan(basePackages={"com.liutao"})
public class Application {


	@Bean
	/**
	 * 开启均衡负载的能力
	 */
	@LoadBalanced
	RestTemplate restTemplate() {
		return new RestTemplate();
	}

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}
}
